// =================================================================
// File: Inode.cpp
// Desc: Implementation of functions from Inode class
// =================================================================

// =================================================================
// INCLUDES
// =================================================================

#include <cstring>
#include "config.h"
#include "Inode.h"

// =================================================================
// FUNCTIONS
// =================================================================

// =================================================================
// Name: Inode::Inode
// Desc: Initializes Inode with provided values
// =================================================================
Inode::Inode(int size, 
		int num_blocks, 
		int num_links, 
		time_t accessed,
		time_t modified,
		time_t changed,
		int block_locations[NUM_BLOCK_LOCATIONS]) :
		size(size),
		num_blocks(num_blocks),
		num_links(num_links),
		accessed(accessed),
		modified(modified),
		changed(changed) {
	memcpy(this->block_locations, block_locations, sizeof(int)*NUM_BLOCK_LOCATIONS);
}

// =================================================================
// Name: Inode::Inode
// Desc: Initializes Inode with default values
// =================================================================
Inode::Inode() 
{
    size = 0;
    num_blocks = 0;
    num_links = 0;
    accessed = 0;
    modified = 0;
    changed = 0;
    for (int i = 0; i < NUM_BLOCK_LOCATIONS; i++) {
        block_locations[i] = -1;
    }
}

// =================================================================
// Name: Inode::~Inode
// Desc: Inode destructor
// =================================================================
Inode::~Inode() 
{
	
}
